<div id="bookform">
<form method="post" onsubmit="checkform(this); return false" id="formpost">
<table width="100%">
<tr>
	<td height="20" class="title2">I. <?php __('Personal details',true)?></td>
</tr>
<tr>
  <td height="5"></td>
</tr>
<tr>
	<td style="padding-left:30px">
		<table width="100%" cellpadding="0" cellspacing="5" border="0">
		<tr>
			<td class="txth" width="150"><?php __('Your full name',true)?> <span class="sao1">*</span></td>
			<td>
					<select style="WIDTH: 60px" name=sex class="tfield">
						<option value="Mr">Mr.</option>
						<option value="Miss">Miss.</option>
						<option value="Mrs">Mrs.</option>
						<option value="Ms">Ms.</option>
						<option value="Dr">Dr.</option>
					  </select> 
					  <input class="tfield" style="width:230px" name=name>
			</td>
		</tr>
		<tr>
			<td class="txth"><?php __('Country',true)?></td>
			<td>
					<select name="country" id="country" class="tfield" style="width:300px">
						<?php echo $country->BuilOptionCountry()?>
					 </select>
			</td>
		</tr>
		<tr>
			<td class="txth"><?php __('Address',true)?> <span class="sao1">*</span></td>
			<td><input style="width:300" name=address class="tfield"></td>
		</tr>
		<tr>
			<td class="txth"><?php __('Your email',true)?> <span class="sao1">*</span></td>
			<td><input style="width:300" name=email class="tfield"></td>
		</tr>
		<tr>
			<td class="txth"><?php __('Fax',true)?></td>
			<td><input class="tfield" name="fax" style=" width:150" /></td>
		</tr>
		<tr>
			<td class="txth"><?php __('Phone',true)?> <span class="sao1">*</span></td>
			<td><input class="tfield" name="phone" style=" width:150" /></td>
		</tr>
		
		</table>
		<?/*------------------------------------------------------------------------------------------*/?>				
	</td>
</tr>
<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2">II. <?php __('Travel Period',true)?></td>
</tr>
<tr>
  <td height="5"></td>
</tr>

	<td class="title2 pl">1. <?php __('Parti and Date',true)?></td>
</tr>
<tr>
	<td style="padding-left:30px">
		<table cellspacing="0" cellpadding=5 width="100%" border="0">		
		<tr>
			<td class="txth" width="150"><?php __('Number of Adults',true)?></td>
			<td colspan="3">
				<select class="tfield" id=adults style="WIDTH: 120px" onchange="compo_select(this,'adults_f')" name=adults> 
					<option value="" selected="selected"><?php __('Please choose',true)?></option>
					<?
					for($j=1;$j<=20;$j++)
					{
						echo '<option value="'.$j.'">'.$j.'</option>';
					}
					?>
					</select>
					<span id="adults_f" style="display:none" class="txth">&nbsp;<?php __('Ages',true)?>
							 <input class="tfield" size="12" name="adults_Ages" id="adults_Ages">
							 e.g. 33,28
					</span>
			</td>
		</tr>
		<tr>
			<td  class="txth"><?php __('Num of Child',true)?> </td>
			<td colspan="3">
						<select class="tfield" id="children" onchange="compo_select(this,'children_f');" 
						name="children"  style="width:120px"> 
							<option value="" selected="selected"><?php __('Please choose',true)?></option>
							<option value="1">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
							<option value="6">6</option>
						</select>
						<span id=children_f style=" display:none" class="txth">&nbsp;<?php __('Ages',true)?>
							  <input class="tfield" size="12" name="children_Ages" id="children_Ages">
							  e.g. 6,8
						</span>	
			 </td>
		</tr>
		<tr>
			  <td class="txth"><?php __('Arrival Date',true)?> <span class="sao1">*</span></td>
			  <td width="110">
				<input id="arrival_date" class="tfield cDatePicker" size="10" name="arrival_date"> 
				 
			  </td>
			  <td width="130" class="txth"><?php __('Arrival Port',true)?></td>
			  <td>
				<select class="tfield" style="WIDTH: 120px" name="arrival_port">
					<option value=""><?php __('Please choose',true)?></option>
					<option value="Hanoi">Hanoi</option>
					<option value="Danang">Danang</option>
					<option value="Ho Chi Minh">Ho Chi Minh</option>
					<option value="Mekong river">Mekong river</option>
			  </select>
			  </td>
		</tr>
        <tr>
               <td  class="txth"><?php __('Departudate',true)?> <span class="sao1">*</span></td>
               <td>
			   		<input class="tfield cDatePicker" size=10 name=departure_date id="departure_date"> 
				</td>
				<td  class="txth"><?php __('Deaparte Port',true)?></td>
                <td  vAlign=center>
					<select class="tfield" style="WIDTH: 120px" name="departure_port" value="departure_port">
                        <option value="" ><?php __('Please choose',true)?></option>
                        <option value="Hanoi">Hanoi</option>
                        <option value="Danang">Danang</option>
                        <option value="Ho Chi Minh">Ho Chi Minh</option>
                        <option  value="Mekong river">Mekong river</option>
                      </select>
				</td>
        </tr>
		<tr>
				<td class="txth"><?php __('Duration',true)?> <span class="sao1">*</span></td>
				<td colspan="3">
					<select class="tfield" style="WIDTH: 120px" name="duration" id="duration">
                          <option value="" selected="selected"><?php __('Please choose',true)?></option>
						  <option value="1 day">1 <?php __('day',true)?></option>
						  <?
						  	for($n=2;$n<=25;$n++)
							{
							?>
							 <option value="<?php echo $n?> days"><?php echo $n?> <?php __('days',true)?></option>
							<?
							}
							?>
							<option value="<?php __('More than 25 days')?>"><?php __('More than 25 days')?></option>
                     </select>
				</td>
		</tr>
		</table>  
		<?/*------------------------------------------------------------------------------------------*/?>                 
	</td>
</tr>
<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2"></td>
</tr>
<tr>
  <td height="5"></td>
</tr>	
<tr>
	<td class="title2 pl">2. <?php __('Destinations in Vietnam',true)?><input type="hidden" name="destinations" id="destinations" value=""></td>
</tr>
<tr>
	<td style="padding-left:30px">
    <div class="listlocation">
        <table>
       <tr>
		<?php
		foreach($locations as $i => $location)
		{
		  $location_childs = ListLocation($location['iId']);
		?>
            <td valign="top">
            <label>
                <strong><?php echo $location['cName']?>	</strong>		
            </label>	
            
            <?php
            foreach($location_childs as $i => $location_child)
		    {
		      ?>
              <label>
                    <input type="checkbox" name="locations[]" value="<?php echo $location_child['cName']?>" />
                    <?php echo $location_child['cName']?>			
                </label>
              <?php
            }
            ?>
            </td>		
		<?
		}
	   ?>
       </tr>
       </table>
        </div>  
	
		<?/*-----------------------------------------------------------------------------*/?>
	</td>
</tr>
<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2">III. <?php __('Activities',true)?><input type="hidden" name="activities" id="activities" value=""></td>
</tr>
<tr>
  <td height="5"></td>
</tr>	
<tr>
  <td style="padding-left:30px">
  		<table width="100%" cellpadding="0" cellspacing="3">
  		
        <tr>
             <td colSpan=4>
                <table width="100%" cellspacing=0 cellpadding=3>
                 <tr>							
<?php
for($i=0;$i<count($arr_easy);$i++)
{
	if($i%5==0)
	{
		echo "<tr vAlign=center align=left>";
	}
	echo "<td class=txth align=right width=\"15%\">".$arr_easy[$i]."</td>";
	echo "<td class=txth align=left  width=\"5%\"><input type=checkbox value='".$arr_easy[$i]."' name=e_$i onchange=\"changecb('activities',this)\"></td>";
					
}
?>						
                            
					</tr></table>
              <table width="100%" cellspacing=0 cellpadding=3>
              <tr>
							
<?php
for($i=0;$i<count($arr_adv);$i++)
{
	if($i%5==0)
	{
		echo "<tr vAlign=center align=left>";
	}
	echo "<td class=txth align=right width=\"15%\">".$arr_adv[$i]."</td>";
	echo "<td class=txth align=left  width=\"5%\"><input type=checkbox value='".$arr_adv[$i]."' name=a_$i onchange=\"changecb('activities',this)\"></td>";
					
}
?>						
                            
			</tr></table>
			</td>
		 </tr>
		</table>
		<?/*--------------------------------------------------------*/?>
  </td>
</tr>
<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2">IV. <?php __('Transportation ',true)?>
	  <input type="hidden" name="transportation" id="transportation" value=""></td>
</tr>
<tr>
  <td height="5"></td>
</tr>	
<tr>
  <td style="padding-left:125px">
  		 <table cellspacing=0 cellpadding=3>
			<tr>
               <td class="txth" width="90px"><?php __('Aircraft ',true)?>
				 <input type=checkbox value="Aircraft" name=airplane onChange="changecb('transportation',this)">
				</td>
                <td class="txth" width="123px"><?php __('Car/Bus',true)?>
				  <input  type=checkbox value="Car/Bus" name=car  onchange="changecb('transportation',this)">
				 </td>
                <td class="txth"><?php __('train',true)?>
				  <input type=checkbox value="train" name=train  onchange="changecb('transportation',this)">
				 </td>
            </tr>
		</table>
		<?/*--------------------------------------------------------*/?>
  </td>
</tr>

<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2">V. <?php __('Accommodation and Meals ',true)?>
		<input type="hidden" name="accommodation_food" id="accommodation_food"></td>
</tr>
<tr>
  <td height="5"></td>
</tr>	
<tr>
  <td style="padding-left:85px">
  		 <table cellspacing=0 cellpadding=3>
                    <tr vAlign=center align=left>
                      <td class="txth" align=right width="15%"><?php __('Hotels',true)?></td>
                      <td vAlign=center align=left width="5%"><input 
                        onclick="changecb('accommodation_food',this);
						showhideRoomtype(this,this.form.resorts,'roomtypediv')" 
                        type=checkbox value=Hotels name=hotels></td>
                      <td class=txth vAlign=center align=right 
                        width="21%"><?php __('Home stays',true)?></td>
                      <td vAlign=center align=left width="5%"><input 
                        type=checkbox value="Home stays" name=homestays 
						onchange="changecb('accommodation_food',this)"></td>
                      <td class=txth vAlign=center align=right 
                        width="12%"><?php __('Resorts',true)?></td>
                      <td vAlign=center align=left width="5%"><input 
                        onclick="changecb('accommodation_food',this);
						showhideRoomtype(this,this.form.hotels,'roomtypediv')"
                        type=checkbox value=Resorts name=resorts></td>
                      <td vAlign=center align=left width="40%"></td></tr>
                    <tr>
                      <td class=txth style="PADDING-LEFT: 75px" 
                      vAlign=center align=left colSpan=7>
					  
                        <DIV id=roomtypediv style="DISPLAY: none">
						<input type="hidden" name="roomtype_details" id="roomtype_details"/>
                        <table cellspacing=0 cellpadding=0 border=0>
                          <TBODY>
                          <tr vAlign=center align=left>
                            <td class=txth align=left 
                              rowSpan=2><?php __('Budget',true)?>:&nbsp;</td>
                            <td align=left rowSpan=2>
							<select class="tfield" 
                              style="WIDTH: 110px" name=roomtype onchange="change_roomtype(this)"> <OPTION 
                                value="" selected><?php __('Please choose',true)?><OPTION 
                                value="Standard ($50);"><?php __('Standard',true)?> ($50)<OPTION 
                                value="Superior (>$100);"><?php __('Superior',true)?> 
                                (&gt;$100)<OPTION value="Deluxe (>$150);"><?php __('Deluxe',true)?> 
                                (&gt;$150)</OPTION></select></td>
                            <td align=left rowSpan=2 class="txth">
								<SPAN 
								  class=txth_link 
								  style="MARGIN-LEFT: 20px"><?php __('Number of room',true)?>:&nbsp;</SPAN></td>
                            <td align=left>
							<select class="tfield"onchange="change_roomtype(this)" style="WIDTH: 90px" name=single>
                              <option value="" selected><?php __('Single',true)?></option>
							  <?
							  for($i=1;$i<=10;$i++)
							  {
							  	echo '<option value="'.$i.' '.__('Single').',">'.$i.' '.__('Single').'</option>';
							  }
							  ?>                           
                            </select></td>
                            <td class=txth align=right>&nbsp;</td>
                            <td class="tfield"align=left>
							<select class="tfield"onchange="change_roomtype(this)" style="WIDTH: 90px" name=double> 
							<OPTION value="" selected><?php __('Double',true)?></OPTION>
							<?
							  for($i=1;$i<=10;$i++)
							  {
							  	echo '<option value="'.$i.' '.__('Double').',">'.$i.' '.__('Double').'</option>';
							  }
							  ?>
							  </select></td></tr>
                          <tr vAlign=center align=left>
                            <td class=txth_link align=left>
							<select onchange="change_roomtype(this)" class="tfield"style="WIDTH: 90px" name=twin> 
                                <OPTION value="" selected><?php __('Twin',true)?></OPTION>
								<?
								  for($i=1;$i<=10;$i++)
								  {
									echo '<option value="'.$i.' '.__('Twin').',">'.$i.' '.__('Twin').'</option>';
								  }
								  ?>
								</select></td>
                            <td class=txth align=right>&nbsp;</td>
                            <td class="tfield"align=left>
							<select class="tfield"onchange="change_roomtype(this)" style="WIDTH: 90px" name=extra_bed>
							 <OPTION value="" selected><?php __('Extrabed',true)?></OPTION>
							 <?
							  for($i=1;$i<=10;$i++)
							  {
								echo '<option value="'.$i.' '.__('Extrabed').',">'.$i.' '.__('Extrabed').'</option>';
							  }
							  ?>
							</select></td></tr></TBODY></table>
							</DIV>
				
				</td></tr>
                    <tr>
                      <td class=txth vAlign=center align=right><?php __('Meals',true)?>: 
                      </td>
                      <td vAlign=center align=left 
                        colSpan=6>
						<select class="tfield" name=meal>
						<OPTION value="<?php __('breakfast',true)?>" selected><?php __('breakfast',true)?></OPTION>
						<OPTION value="<?php __('breakfast',true)?> &amp; <?php __('lunch',true)?>">
										<?php __('breakfast',true)?> &amp; <?php __('lunch',true)?></OPTION>
                        <OPTION value="<?php __('breakfast',true)?> &amp; <?php __('Dinner',true)?>">
									<?php __('breakfast',true)?> &amp; <?php __('Dinner',true)?></OPTION>
						 <OPTION value="<?php __('breakfast',true)?>,<?php __('lunch',true)?> &amp; <?php __('Dinner',true)?>">
						 		<?php __('breakfast',true)?>,<?php __('lunch',true)?> &amp; <?php __('Dinner',true)?> </OPTION>
				  </select>
			</td>
		</tr>
	</table>
	<?/*--------------------------------------------------------*/?>
  </td>
</tr>

<tr>
  <td height="10"></td>
</tr>
<tr>
	<td height="20" class="title2">VI. <?php __('Questions and Comments',true)?></td>
</tr>
<tr>
  <td height="5"></td>
</tr>	
<tr>
  <td style="padding-left:30px">
  		 <table cellspacing=0 cellpadding=3 width="100%" border="0">
           <tr>
             <td colspan="2">
              <textarea class="tfield" style="width:90%; height:80"  name=comments></textarea>
			 </td>
		</tr>
         <tr>
             <td class=txth width="200"><?php __('How find us',true)?>?</td>
             <td>
			 	<select class="tfield" name=findus> 
					<option value="None"><?php __('Please choose',true)?></option>
						<option value="<?php __('Word of mouth',true)?>"><?php __('Word of mouth',true)?></option>
						<option value="<?php __('Internet',true)?>"><?php __('Internet',true)?></option>
						<option value="<?php __('Repeat customer',true)?>"><?php  __('Repeat customer',true)?></option>
						<option value="<?php __('Guide books',true)?>"><?php __('Guide books',true)?></option>
						<option value="<?php __('Our brochure',true)?>"><?php __('Our brochure',true)?></option>
						<option value="<?php __('Press adverts',true)?>"><?php __('Press adverts',true)?></option>
						<option value="Other"><?php __('Other',true)?></option>
				</select>
			</td>
		</tr>       
		<tr>
			<td  class="txth" nowrap=""><?php __('Enter the spam code',true)?> <span class="sao1">*</span> </td>
			<td valign="top">
				<table cellspacing=0 cellpadding="0">
					<tr>
						<td align="left">
						<input class="tfield" maxlength="5" style="width: 50px;" id="SpamCode" name="SpamCode" />
        	  	        <img id="imgcodespam" src="/ImgSpam/<?echo time()?>.jpg" width="100" height="20" alt="Code Spam" 
        						onclick="this.src='/ImgSpam/f'+Math.random()+'.jpg'" class="cpointer"/>
						</td>
					</tr>
				</table>	
			</td>
		</tr>
		<tr>
			<td></td>
			<td style="padding-top:10">
				<input class=button1 id="button_send" type=submit value="<?php __('Send',true)?>" style="width:70; height:20">&nbsp;&nbsp;&nbsp; 
			
			</td>
		</tr>
      </table>  	
  </td>
</tr>
</table>
</form>
</div>

<script language=javascript>
$(function(){
	// Datepicker
	$('.cDatePicker').datepicker({
		inline: true,
        format: 'Y-m-d'
	});
});

	function showhideRoomtype(box1,box2,id)  
	{ 
		var elm = document.getElementById(id) ;
		form=box1.form;
		if(box1.checked)
		{
			elm.style.display = "inline"; 
		}else if(box2.checked)
		{
			elm.style.display = "inline";
		}else
		{
			elm.style.display = "none";
		}
	}
	
	function change_roomtype(se)
	{
		form=se.form;
		rt="; "+form.roomtype.value;
		rt=rt+form.single.value;
		rt=rt+form.twin.value;
		rt=rt+form.double.value;
		rt=rt+form.extra_bed.value;	
		form.roomtype_details.value=rt;	
	}
	
	function clickclear(thisfield, defaulttext) {
		if (thisfield.value == defaulttext) {
		thisfield.value = "";
		}
	}
	function clickrecall(thisfield, defaulttext) {
		if (thisfield.value == "") {
		thisfield.value = defaulttext;
		}
	}

	function changecb(id,cb)
	{
		form=cb.form;
		if(cb.checked)
		{
			form[id].value+=cb.value+", ";
		}else
		{
			form[id].value=(form[id].value).replace(cb.value+", ","");
		}
	}
    


function compo_select(se,div)
{
	chil = se.options[se.selectedIndex].value;
	if(chil !== ''){
		document.getElementById(div).style.display='';
	} else
	{
		document.getElementById(div).style.display='none';
	}
}

function check_num(tef)
{
	if(tef.value!="" &&(Number(tef.value).toString()== "NaN" || Number(tef.value)<=0))
	{
		alert("<?php __('Not value number')?>");	
		tef.value="";
		tef.focus();	
	}
}
function listlocation()
{
	document.getElementById("destinations").value="";
	for(i=1;i<200;i++)
	{
		try{
		num_value=document.getElementById("loin_"+i).value;
		loname=document.getElementById("lohi_"+i).value;		
		if(Number(num_value).toString()!= "NaN" && Number(num_value)>0)
		{
			document.getElementById("destinations").value+=loname+": "+num_value+" <?php _DAYS?>;";
		}
		}catch(e){}
	}
}



function checkform(fox)
{
	if(fox.name.value=="")
	{
		alert("<?php echo __('Please enter your name')?>!");
		fox.name.focus();
		return false;
	}
    if(fox.address.value=="")
	{
		alert("<?php echo __('Please enter your address')?>!");
		fox.address.focus();
		return false;
	}
	if(!isEmail(fox.email.value))
	{
		alert("<?php echo __('Please enter your email')?>!");
        fox.email.focus();
        return false;
	}
    if(fox.SpamCode.value == "")
 	{
 		alert("<?php echo __('Please enter security code')?>!");		
 		fox.SpamCode.focus();
 		return false;
 	}	
	jQuery.post("/as/inserttripplanner",
      $("#formpost").serialize(),
      function(msg){
         postsuccess(msg);
      },
      'json'
    );
    getId('button_send').value="<?php echo __('Sending')?>...";
}       
function postsuccess(obj)
{
    getId('button_send').value="<?php echo __('Send')?>";
    if(obj.status=='spam')
    {
        getId('SpamCode').value='';
        getId('imgcodespam').src = '/ImgSpam/'+Math.random()+'.jpg';        
    }
    else if(obj.status=='ok')
    {
        getId('bookform').innerHTML=obj.msg;
        return;
    }
    if(obj.msg)
    {
        alert(obj.msg);
    }else
    {
        alert(obj);
    }
    
}
</script>
